﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TZRerport_Dal.Dal
{
    public class BaseSixTJDal: BaseTJDal
    {
        public override void SetQuertSql()
        {
            base.GetTiJianBModelSql = GetSql;
        }

        private string GetSql(string msg)
        {
            string sql = $@"SELECT {msg} tjb.TiJianH AS TiJianLSH,
tjb.TiJianH,
CONVERT(VARCHAR(100),tjb.DengJiRQ,120) AS DengJiRQ,
CONVERT(VARCHAR(100),tjb.TiJianRQ,120) AS TiJianRQ,
CONVERT(VARCHAR(100),tjb.ChuShengRQ,120) AS ChuShenRQ,
CONVERT(VARCHAR(100),tjb.ZongJianRQ,120) AS ZongJianRQ, 
tjb.XingMing,
tjb.XingBie,
CONVERT(VARCHAR(20),tjb.NianLing) AS NianLing,
tjb.ShenFenZhengH AS ShenFenZH,
tjb.HunYinZK,
tjb.ShouJiH AS ShouJiH,
tjb.TiJianLB,
tjb.HeTongBM AS DanWeiBM
 FROM TiJianB AS tjb
LEFT JOIN TZ_Report_Record AS record
ON tjb.TiJianH=record.physical_serial_no
WHERE tjb.ShangChuBZ='否' AND 
tjb.Status>3 AND ISNULL(tjb.ShenFenZhengH, '')>'' AND ISNULL(tjb.ShouJiH, '')>'' AND record.physical_serial_no IS NULL";

            return sql;
        }
    }
}
